package com.cmdi.mq.controller;

import com.cmdi.mq.service.impl.SeataTestServiceImpl;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @Description: java类作用描述
 * @Author: gaozb
 * @Date: 2021/8/21$ 20:31$
 * @Version: 1.0
 */
@RestController
public class TestController {
    @Value("${server.port}")
    private String port;

    @Autowired
    private SeataTestServiceImpl seataTestService;

    @RequestMapping("/a")
    @Trace
    public String a() {

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return port + ": a";
    }

    @RequestMapping("/user/info")
    public Principal principal(Principal principal) {
        return principal;
    }

    @RequestMapping("/seata")
    public void seata(int a, int b, int c) {
        seataTestService.test(a,b,c);
    }
}